package com.echo.code.spring.mail;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

/**
 * Description
 *
 * @author baiyp
 * @version 1.0.0
 * @date 2019/04/23
 */
@Component
public class MailSender {

  @Autowired
  private JavaMailSender sender;

  public void sendMail() {
    SimpleMailMessage mailMessage = new SimpleMailMessage();
    mailMessage.setFrom("baiyapeng@aspirecn.com");
    mailMessage.setTo("1434943506@qq.com");
    mailMessage.setReplyTo("baiyapeng@aspirecn.com");
    mailMessage.setSubject("主题");
    mailMessage.setText("内容：测试");
    sender.send(mailMessage);
  }
}
